#include<bits/stdc++.h>
using namespace std;
long long s[200005];
int n,a,b,c;
long long ans=0;
int main() {
	scanf("%d%d%d%d",&n,&a,&b,&c);
	if(n==c) {
		printf("1");
		return 0;
	}
	s[n] = 1;
	for(int i = n; i > c; i--) {
		if(i - a > c) {
			s[i-a] += s[i];
			s[i-a]%=1000000007;
		} else {
			ans+=s[i];
		}

		if(i-b>c) {
			s[i-b]+=s[i];
			s[i-b]%=1000000007;
		} else {
			ans+=s[i];
		}
		ans%=1000000007;
	}
	printf("%lld",ans);
	return 0;
}

